<?php

/**
* alltosun.com 焦点图widget focus.php
* ============================================================================
* 版权所有 (C) 2009-2014 北京互动阳光科技有限公司，并保留所有权利。
* 网站地址: http://www.alltosun.com
* ----------------------------------------------------------------------------
* 许可声明: 这是一个开源程序，未经许可不得将本软件的整体或任何部分用于商业用途及再发布。
* ============================================================================
* $Author: 吴松键 (wusj@alltosun.com) $
* $Date: 2014-9-2 下午6:32:19 $
* $Id$
*/

class focus_widget
{
    public function get_list($params)
    {
        $filter = array();

        if (isset($params['position']) && $params['position']) {
            $filter['position'] = $params['position'];
        }
        if (isset($params['pre_page']) && $params['pre_page']) {
            $limit = ' LIMIT 0,'.$params['pre_page'];
        }
        $filter['status'] = 1;

        $list = array();
        $list = _model('focus')->getList($filter, ' ORDER BY `add_time` DESC '.$limit);

        return $list;
    }

    /*
    public function get_list($params)
    {
        $filter = array();

        if (isset($params['position']) && $params['position']) {
            $filter['position'] = $params['position'];
        }
        if (isset($params['pre_page']) && $params['pre_page']) {
            $limit = ' LIMIT 0,'.$params['pre_page'];
        }

        $focus_columns_ids = _model('focus')->getFields('columns_id', array('position'=>$params['position']), ' GROUP BY `columns_id` ');

        $list = array();
        if (!empty($focus_columns_ids)) {
            foreach ($focus_columns_ids as $k=>$v) {
                $filter['columns_id'] = $v;
                $list[$v] = _model('focus')->getList($filter, ' ORDER BY `add_time` DESC '.$limit);
            }
        } else {
            $list = _model('focus')->getList($filter, ' ORDER BY `add_time` DESC '.$limit);
        }

        return $list;
    }
    */
}
?>